/**
 *
 *  Project      :  UVa's acm
 *  Project site :  code.google.com/p/uvaacm/
 *  Author       :  Ives Liao
 *  E-Mail       :  iveslazycat at gmail.com
 *  Date         :  2011/11/17
 *  Website      :  iveslazycat.pixnet.net
 *  
 */
#ifdef ONLINE_JUDGE /* If compiler is UVa's online judge */
    #include<stdio.h> /*Include standard header foe UVa's compiler */
    #define INPUT stdin /* Define the input is from standard input */
    int main() {/* main() for UVa's online judge */
#else
    #include"header.h" /* Include my own header */
    #define INPUT fptIn /* Define the input is from input file */
    int acm_10370() {/* function name for my own */
        printf("--acm_10370 begin here--\n");/* Print begining of problem */
        FILE *fptIn = fopen("Resource/acm_10370.txt","r");/* Open input file to test */
        if ( fptIn == NULL )/* Distinguish the fptInIn file is load success. */
        {
            printf("File acm_10370.txt load fail.\n");/* Telling user file loading failed. */
            printf("Program will exit.\n");/* Telling user function gonna end. */
            return EXIT_FAILURE;/* Return to problem selector(main) */
        }
#endif
/*---------- Do primary statment below here ----------*/
    int runTimes,gradeNum,i,lowerNum;
    int grade[1000];
    double avg,percent;
    for( fscanf(INPUT," %d",&runTimes) ; runTimes > 0 ; runTimes = runTimes - 1){/* Run next set of grades */
        for( fscanf(INPUT," %d",&gradeNum), i = 0, avg = 0.0 ; i < gradeNum ; i = i + 1){/*Run a set of grades */
            fscanf(INPUT,"%d ",&grade[i]);
            /*printf("%d ",grade[i]);*/
            avg = avg + grade[i];
        }
        /*printf("\n");*/
        avg = (float)avg / gradeNum;/* Get avg */
        /*printf("AVG is : %.3f\n",avg);*/
        for( i = 0, lowerNum = 0 ; i < gradeNum ; i = i + 1 ){/* Find number of lower than avg */
            if( grade[i] > avg )
            {
                lowerNum = lowerNum + 1;
            }
        }
        percent =  (lowerNum/ ( (float) gradeNum ) * 100);
        printf("%.3f%%\n",percent);/* printf %.3f is already do round */
        /* End of process a set */
    }




/*---------- Do primary statment above here ----------*/
    #ifndef ONLINE_JUDGE/* If compiler isn't UVa's online judge */
        printf("--acm_10370 end here--\n");/* Print end of problem */
        fclose(fptIn);/* Close file */
    #endif
    return 0;
}
/*---------- Do sub function statment below here ----------*/

/*---------- Do sub function statment above here ----------*/
